/*
Filter panel
==============================================
Styling for filter panel component.
This file contains the generic styling for all filter items.
*/

.filter-panel {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    margin-bottom: 8px;
}

.icon.icon-filter-panel-item-toggle {
    margin-left: 8px;

    > svg {
        top: 4px;
    }
}

.filter-panel-items-container {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    margin-bottom: 8px;
    width: 100%;
}

.filter-panel-item {
    margin-right: 12px;
    margin-bottom: 12px;

    .filter-panel-item-toggle {
        --#{$prefix}btn-focus-box-shadow: #{$input-btn-focus-box-shadow};
        --#{$prefix}btn-border-color: #{$input-border-color};
        --#{$prefix}btn-hover-border-color: #{$input-border-color};
        --#{$prefix}btn-active-border-color: #{$primary};
        --#{$prefix}btn-active-color: #{$primary};
        --#{$prefix}btn-font-weight: #{$font-weight-normal};
    }
}

.filter-panel-item-toggle.show {
    .icon-filter-panel-item-toggle svg {
        color: $primary;
        transform: rotate(180deg);
    }
}

.filter-panel-item-dropdown {
    min-width: 240px;
    max-height: 200px;
    overflow: auto;
    padding: 13px 0;
}

.filter-panel-submit {
    height: 40px;
    margin-bottom: 12px;
    border: 1px solid $primary;
    background-color: $white;
    color: $dark;
}

.filter-active {
    --#{$prefix}btn-focus-box-shadow: #{$input-btn-focus-box-shadow};
    --#{$prefix}btn-border-color: #{$input-border-color};
    --#{$prefix}btn-hover-border-color: #{$primary};
    --#{$prefix}btn-hover-color: #{$primary};
    --#{$prefix}btn-hover-bg: #{$gray-100};
    --#{$prefix}btn-active-border-color: #{$primary};
    --#{$prefix}btn-active-color: #{$primary};
    --#{$prefix}btn-font-weight: #{$font-weight-normal};
    --#{$prefix}btn-border-radius: #{$border-radius-pill};
    --#{$prefix}btn-padding-y: 0.125rem;
    --#{$prefix}btn-line-height: 1.625rem;
}

.filter-active-preview {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid $border-color;
    margin-right: 0.25rem;
    background-position: center center;
    background-size: cover;
    vertical-align: -0.125em;
}

.btn.filter-reset-all {
    --#{$prefix}btn-border-radius: #{$border-radius-pill};
    --#{$prefix}btn-padding-y: 0.125rem;
    --#{$prefix}btn-line-height: 1.625rem;
    --#{$prefix}btn-font-weight: #{$font-weight-normal};
}

.is--sidebar {
    .filter-panel,
    .filter-panel-items-container {
        display: block;
    }

    .filter-panel-item-dropdown {
        min-width: 100%;
        border: 1px solid $primary;
        border-top: 0;
        border-radius: 0 0 4px 4px;
    }

    .filter-panel-item {
        margin-right: 0;
        width: 100%;
    }

    .filter-panel-item-toggle {
        text-align: left;
        display: flex;

        &[aria-expanded='true'] {
            color: $primary;
            border-color: $primary;
            border-bottom-left-radius: 0;
            border-bottom-right-radius: 0;
            border-bottom: 0 none;

            svg {
                color: $primary;
                transform: rotate(180deg);
            }
        }
    }

    .icon-filter-panel-item-toggle {
        margin-left: auto;

        > svg {
            top: 0;
        }
    }
}

.is-loading {
    .filter-panel-item-toggle,
    .filter-active,
    .filter-reset-all,
    .filter-boolean,
    .filter-panel-submit {
        pointer-events: none;
        opacity: 0.6;
    }
}

.btn.filter-panel-wrapper-toggle {
    --#{$prefix}btn-padding-x: 6px;
    --#{$prefix}btn-padding-y: 6px;
    --#{$prefix}btn-hover-bg: var(--#{$prefix}gray-200);
    --#{$prefix}btn-hover-color: var(--#{$prefix}primary);
    --#{$prefix}btn-active-bg: var(--#{$prefix}gray-200);
    --#{$prefix}btn-active-color: var(--#{$prefix}primary);
    display: none;
    width: 100%;

    .icon {
        color: currentColor;
        margin-right: $spacer-sm;
        vertical-align: text-bottom;

        svg {
            top: 0;
        }
    }
}

.filter-panel-offcanvas-header {
    height: 80px;
    align-items: center;
    padding: 25px;
    display: none;
}

.filter-panel-offcanvas-title {
    margin-bottom: 0;
    font-size: $h3-font-size;
    font-weight: $font-weight-bold;
    color: $headings-color;
}

.filter-panel-offcanvas-close {
    margin-left: auto;
}

@include media-breakpoint-down(lg) {
    .btn.filter-panel-wrapper-toggle {
        display: block;
    }

    .filter-panel-wrapper {
        display: none;
    }
}

.offcanvas-filter {
    overflow: hidden;

    .filter-panel {
        height: calc(100% - 80px);
        overflow-y: auto;
        width: 100%;
        padding: 0 25px 25px;
    }

    .filter-panel-offcanvas-header {
        display: flex;
    }
}
